#include "../../common/commonbase.h"

namespace XIAOO{
    class SocketHandle{
        public:
            SocketHandle();
            ~SocketHandle();

        public:
            //encode route
            std::string  onReadHandle(int sockfd, std::string readBuffer);
            
            // 处理单发或者群发
            void onWriteHandle(int sockfd, std::string writeBuffer);

            // 处理玩家下线
            void onOfflineHandle(int sockfd);

        private:
            void parseControllerAndAction(std::string *controller, std::string *action);
            Json::Value routeMap(Json::Value root, std::string controller, std::string action, int sockfd);

        private:
            std::string route;
    };
}